package thread;
//多线程第一天
public class ThreadDemo3 {
    public static void main(String[] args) {
        //继承thread重写run方法
        Thread t1 = new MyThread1(){
            public void run(){
                for (int i = 0; i < 100; i++) {
                    System.out.println("11111");
                }
            }
        };
//      实现Runnable接口重写方法
        Runnable r2= new MyRunnable3();  //实例化对象
        Thread t2 = new Thread(r2);    //创建线程
        t1.start(); //启动线程
        t2.start();
    }
}
class  MyRunnable3 implements  Runnable{
    public void run(){
        for (int i = 0; i < 1000; i++) {
            System.out.println("2222");
        }
    }
}